<?php
namespace app\index\model;

class News extends Bass{
    // 确定链接表名
    protected $name = 'news';

    /**
     * 查询项目
     * @param $where
     */
    public function getNewsByWhere($where)
    {
        return $this->where($where)->order('id desc')->limit('4')->select();
    }
    public function getNewsById($id){
        if(!$id){
            return [];
        }
        $where = " id = {$id}";
        return $this->where($where)->find();
    }
    public function getAllNews(){
        return $this->order('id desc')->select();
    }
}